<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改部门')" />
	<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-order-edit" th:object="${socVo}">
			<input name="id" type="hidden" th:field="*{id}" />

			<div class="form-group">
				<label class="col-sm-1 control-label is-required">箱属：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="cusNo" id="cusNo"
							th:with="cusNoVoList=${@dict.getCusNo()}" required data-live-search="true"
							liveSearchStyle="contains" title="所有">
						<option th:each="cusNoVo : ${cusNoVoList}" th:text="${cusNoVo.name}"
								th:value="${cusNoVo.id}" th:field="*{cusNo}"></option>
					</select>
				</div>


				<label class="col-sm-1 control-label is-required">船公司：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="cusNoS" id="cusNoS"
							th:with="cusNoVoList=${@dict.getCusNoS()}" required data-live-search="true"
							liveSearchStyle="contains" title="所有">
						<option th:each="cusNoVo : ${cusNoVoList}" th:text="${cusNoVo.name}"
								th:value="${cusNoVo.id}" th:field="*{cusNoS}"></option>
					</select>
				</div>
				<label class="col-sm-1 control-label is-required">箱型：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="xx" id="xx">
						<option value="20" th:field="*{xx}">20</option>
						<option value="40" th:field="*{xx}">40</option>
					</select>
				</div>
				<label class="col-sm-1 control-label is-required">尺寸：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="cc" id="cc">
						<option value="GP" th:field="*{cc}">GP</option>
						<option value="HC" th:field="*{cc}">HC</option>
						<option value="TK" th:field="*{cc}">TK</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label is-required">运抵国：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="country" id="country"  th:field="*{country}">
				</div>
				<label class="col-sm-1 control-label is-required">指运港：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="port" id="port"  th:field="*{port}">
				</div>
				<label class="col-sm-1 control-label is-required">箱数：</label>
				<div class="col-sm-2">
					<input class="form-control" type="number" name="num" id="num" th:field="*{num}">
				</div>
				<label class="col-sm-1 control-label is-required">箱皮重：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="boxWeight" id="boxWeight" th:field="*{boxWeight}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label is-required">船名：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="shipName" id="shipName" th:field="*{shipName}">
				</div>
				<label class="col-sm-1 control-label is-required">航次：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="ovoy" id="ovoy" th:field="*{ovoy}">
				</div>
				<label class="col-sm-1 control-label is-required">提单号：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="tdNo" id="tdNo" th:field="*{tdNo}">
				</div>
				<label class="col-sm-1 control-label is-required">箱号：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="boxNo" id="boxNo" th:field="*{boxNo}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label is-required">发货人：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="sendCustomer" id="sendCustomer"
							th:with="shipperList=${@customer.getShipperList()}" data-live-search="true"
							liveSearchStyle="contains" title="所有">
						<option th:each="shipper : ${shipperList}" th:text="${shipper.name}"
								th:value="${shipper.id}" th:field="*{sendCustomer}"></option>
					</select>
				</div>
				<label class="col-sm-1 control-label is-required">收货人：</label>
				<div class="col-sm-2">
					<select class="selectpicker form-control" name="receiveCustomer" id="receiveCustomer"
							th:with="consigneeList=${@customer.getConsigneeList()}" data-live-search="true"
							liveSearchStyle="contains" title="所有">
						<option th:each="consignee : ${consigneeList}" th:text="${consignee.name}"
								th:value="${consignee.id}" th:field="*{receiveCustomer}"></option>
					</select>
				</div>
				<label class="col-sm-1 control-label is-required">报关单号</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="bgdNo" id="bgdNo" th:field="*{receiveCustomer}">
				</div>
				<label class="col-sm-1 control-label is-required">品名：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="productName" id="productName" th:field="*{receiveCustomer}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label is-required">编码：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="productCode" id="productCode" th:field="*{productCode}">
				</div>
				<label class="col-sm-1 control-label is-required">重量：</label>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="weight" id="weight" th:field="*{weight}">
				</div>
				<label class="col-sm-1 control-label is-required">出口日期</label>
				<div class="col-sm-2">
					<div class="input-group date"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" class="form-control" name="outDate" id="outDate" autocomplete="off" required th:field="*{outDate}">
					</div>
				</div>
				<label class="col-sm-1 control-label is-required">进口日期</label>
				<div class="col-sm-2">
					<div class="input-group"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" class="form-control" name="inDate" id="inDate" autocomplete="off" required th:field="*{inDate}">
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label is-required">排序号：</label>
				<div class="col-sm-2">
						<input type="text" class="form-control" name="sort" id="sort" autocomplete="off" required th:field="*{sort}">
				</div>
				<label class="col-sm-1 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea class="form-control" type="text" name="remark" id="remark" th:field="*{remark}"></textarea>
				</div>
			</div>
			<div class="form-group" style="display: none">
				<div class="col-sm-2">
					<input class="form-control" type="text" name="zs" id="zs" value="">
				</div>
				<div class="col-sm-2">
					<input class="form-control" type="text" name="bgdImg" id="bgdImg" value="">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 ">证书：</label>
				<div class="col-sm-5 ">
					<input id="fileinput-demo-1" type="file" multiple data-max-file-count="1">
				</div>
				<label class="col-sm-1 ">报关单：</label>
				<div class="col-sm-5">
					<input id="fileinput-demo-2" type="file" multiple data-max-file-count="1">
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: bootstrap-fileinput-js"/>
	<script type="text/javascript">
		var prefix = ctx + "business/order2";


		//图片上传
		$(document).ready(function () {
			$("#fileinput-demo-1").fileinput({
				'theme': 'explorer-fas',
				'uploadUrl': prefix + "/uploadFile/1",
				overwriteInitial: false,
				initialPreviewAsData: true,
				initialPreview: [],
				maxFileSize: 2048,//单位为kb，如果为0表示不限制文件大小
				minFileCount: 1, //每次上传允许的最少文件数。如果设置为0，则表示文件数是可选的。默认为0
				maxFileCount: 1, //每次上传允许的最大文件数。如果设置为0，则表示允许的文件数是无限制的。默认为0
			});
		});
		$('#fileinput-demo-1').on('fileuploaded', function (event, data, previewId, index) {
			console.log("data==:" + data.response.data);
			$("#zs").val(data.response.data);
		});
		//图片上传
		$(document).ready(function () {
			$("#fileinput-demo-2").fileinput({
				'theme': 'explorer-fas',
				'uploadUrl': prefix + "/uploadFile/2",
				overwriteInitial: false,
				initialPreviewAsData: true,
				initialPreview: [],
				maxFileSize: 2048,//单位为kb，如果为0表示不限制文件大小
				minFileCount: 1, //每次上传允许的最少文件数。如果设置为0，则表示文件数是可选的。默认为0
				maxFileCount: 1, //每次上传允许的最大文件数。如果设置为0，则表示允许的文件数是无限制的。默认为0
			});
		});
		$('#fileinput-demo-2').on('fileuploaded', function (event, data, previewId, index) {
			console.log("data==:" + data.response.data);
			$("#bgdImg").val(data.response.data);
		});

		layui.use('laydate', function () {
			var laydate = layui.laydate;
			laydate.render({
				elem: '#outDate',
				type: 'date',
				trigger: 'click',
				value: new Date()
			});
			laydate.render({
				elem: '#inDate',
				type: 'date',
				trigger: 'click',
				value: new Date()
			});
		})

		$("#form-order-edit").validate({
			focusCleanup: true
		});

		function submitHandler() {
			if ($.validate.form()) {
				$.operate.save(prefix + "/edit", $('#form-order-edit').serialize());
			}
		}
	</script>
</body>
</html>
